<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
	</PropertyGroup>

	<!-- F# targets import these specifically, prevent them being reimported-->
	<PropertyGroup>
		<CustomBeforeMicrosoftCommonTargets></CustomBeforeMicrosoftCommonTargets>
	</PropertyGroup>

	<!-- force a bunch of default values for consistency -->
	<PropertyGroup>
		<MDConfigIsRelease>$(Configuration.Contains('Release'))</MDConfigIsRelease>
		<MDConfigIsDebug>$(Configuration.Contains('Debug'))</MDConfigIsDebug>
		<Optimize>$(MDConfigIsRelease)</Optimize>
		<Tailcalls>$(Optimize)</Tailcalls>
		<DebugSymbols>true</DebugSymbols>
		<DebugType>portable</DebugType>
		<WarningLevel>4</WarningLevel>
		<Deterministic>True</Deterministic>
	</PropertyGroup>

	<!-- AddinBuildDir is shorthand for which subdir of build\Addins to build into -->
	<PropertyGroup Condition="'$(AddinBuildDir)'!=''">
		<OutDir>$(MonoDevelopRootDir)build\AddIns\$([MSBuild]::EnsureTrailingSlash('$(AddinBuildDir)'))</OutDir>
	</PropertyGroup>

	<!-- produce docs unless explicitly disabled -->
	<PropertyGroup Condition="'$(SuppressDocs)'!='True'">
		<DocsDir>$([MSBuild]::ValueOrDefault('$(OutDir)', '$(OutputPath)'))</DocsDir>
		<DocumentationFile Condition="'$(DocsDir)' !=''">$([MSBuild]::EnsureTrailingSlash('$(DocsDir)'))$(AssemblyName).xml</DocumentationFile>
		<!-- don't warn about missing doc comments -->
		<NoWarn>$(NoWarn);1591;1573</NoWarn>
	</PropertyGroup>

	<!-- https://aka.ms/roslyn-packages has a list that maps Roslyn version to latest language version -->
	<!-- Set the roslyn language version to the latest stable version our provisioned csc supports -->
	<PropertyGroup Condition="'$(MSBuildProjectExtension)'=='.csproj'">
		<LangVersion>8.0</LangVersion>
	</PropertyGroup>

	<PropertyGroup Condition="'$(MSBuildProjectExtension)'=='.vbproj'">
		<LangVersion>15.5</LangVersion>
	</PropertyGroup>

	<PropertyGroup Condition="'$(MDConfigIsDebug)'=='true'">
		<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
	</PropertyGroup>

	<PropertyGroup Condition="$(Platform.Equals('x86'))">
		<PlatformTarget>x86</PlatformTarget>
	</PropertyGroup>

	<PropertyGroup Condition="$(Platform.Equals('x64'))">
		<PlatformTarget>x64</PlatformTarget>
	</PropertyGroup>

	<PropertyGroup Condition="$(Configuration.Contains('Mac'))">
		<DefineConstants>$(DefineConstants);MAC</DefineConstants>
	</PropertyGroup>

	<PropertyGroup Condition="$(Configuration.Contains('Win32'))">
		<DefineConstants>$(DefineConstants);WIN32;WINDOWS</DefineConstants>
	</PropertyGroup>

	<PropertyGroup Condition="$(Configuration.Contains('Gnome'))">
		<DefineConstants>$(DefineConstants);GNOME;LINUX</DefineConstants>
	</PropertyGroup>

	<Target Name="RemoveNoisyAnalyzers" BeforeTargets="CoreCompile">
		<ItemGroup>
			<!--
			This analyzer gets pulled in by Microsoft.VisualStudio.Threading, propagates
			through most of the solution, and produces an overwhelming amount of noise.
			Disable it for now until someone can go audit all its warnings.
			-->
			<Analyzer Remove="@(Analyzer->WithMetadataValue('Filename', 'Microsoft.VisualStudio.Threading.Analyzers.CodeFixes'))" />
			<Analyzer Remove="@(Analyzer->WithMetadataValue('Filename', 'Microsoft.VisualStudio.Threading.Analyzers'))" />
			<Analyzer Remove="@(Analyzer->WithMetadataValue('Filename', 'Microsoft.VisualStudio.Threading.Analyzers.resources'))" />
			<!-- thes analyzers are pulled in by Roslyn but aren't particularly relevant and have some internal errors -->
			<Analyzer Remove="@(Analyzer->WithMetadataValue('Filename', 'Microsoft.CodeAnalysis.CSharp.Analyzers'))" />
			<Analyzer Remove="@(Analyzer->WithMetadataValue('Filename', 'Microsoft.CodeAnalysis.Analyzers'))" />
		</ItemGroup>
	</Target>

	<ItemGroup Condition="$(MSBuildProjectName) != 'MonoDevelop.Core'">
		<Reference Include="$(NuGetPackageRoot)microsoft.visualstudio.composition/$(NuGetVersionVSComposition)/lib/net45/Microsoft.VisualStudio.Composition.dll">
			<Private>false</Private>
			<NuGetPackageId>Microsoft.VisualStudio.Composition</NuGetPackageId>
		</Reference>
	</ItemGroup>

	<!--
	Hide these refs behind an import so NuGet doesn't see them and generate spurious NU1108 "cycle detected" errors even when the condition is false.
	This means that they have to be imported AFTER the project instead of before it, so the project can set AddMonoDevelopCoreReferences.
	-->
	<Import Project="$(MSBuildThisFileDirectory)CoreReferences.props" Condition="'$(AddMonoDevelopCoreReferences)' == 'true'" />


</Project>
